/**
*  检查是否包含数字以外的内容
**/
function numcheck(obj){
	return obj.match( /^[0-9]+$/);
}
//url地址正则检测
function IsURL(str_url){
    var strRegex = "^((https|http|ftp|rtsp|mms)?://)" 
    + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ 
          + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 
          + "|" // 允许IP和DOMAIN（域名）
          + "([0-9a-z_!~*'()-]+\.)*" // 域名- www. 
          + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 
          + "[a-z]{2,6})" // first level domain- .com or .museum 
          + "(:[0-9]{1,4})?" // 端口- :80 
          + "((/?)|" // a slash isn't required if there is no file name 
          + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; 
          var re=new RegExp(strRegex); 
    //re.test()
          if (re.test(str_url)){
              return (true); 
          }else{ 
              return (false); 
          }
      }

/*
**** member.tpl
**** 查询用户
*/
function usercheck(){
	var val  = document.getElementById("selectvalue").value;
	var obj  = document.getElementById("stylename");
	var ind  = obj.selectedIndex;
	var styl = obj.options[ind].value;
	var stat = numcheck(val);
	if(val != "")
	{
			if(styl != 0)
		{		
			if(Number(styl) == 1){
				if(stat){
					document.theForm.submit();
				}else{
					alert("请输入正确的内容!");
				}
			}
			if(Number(styl) == 2){
				document.theForm.submit();
			}
			if(Number(styl) == 3){
				if(stat && val.length == 11)
				{
					document.theForm.submit();
				}else{
					alert("请输入正确的内容!");
				}
			}
		}else
			{   
				alert("请选择类型!");
			}
	}else 		
	{
		alert("请输入内容!");
	}
}
/**
 *  userdetial.php 
 *  会员充值
**/
function addusermoney(){
		var val = document.getElementById("addmoneynum").value;
		var sta = numcheck(val)
		if(sta){
			document.theForm.submit();
		}else{
			alert("请输入正确的内容");
		}
}

/**
 * owen.php 
 * 修改密码
**/
function updatepassword(){
		var oldpassword = document.getElementById("oldpassword").value;
		var newpassword = document.getElementById("newpassword").value;
		var respassword = document.getElementById("respassword").value;
		if(oldpassword!=""&&newpassword!=""&&respassword!=""){
			if(newpassword != respassword){
				alert("新密码两次密码输入不同!");
			}else{
				document.theForm.submit();
			}
		}else{
			alert("请输入内容!")
		}
}
/**
 * friendadd.php 
 * 友情链接
**/
function friendlink(){
		var name = document.getElementById("linkname").value;
		var addr = document.getElementById("linkaddres").value;
		var rank = document.getElementById("linkrank").value;
		if(name != "" && addr != "" && rank != ""){
			if(IsURL(addr)){
				if(numcheck(rank)){
					document.theForm.submit();
				}else{
					alert("排序只能是数字");
			   }
			}else{
				alert("请输入正确的网址");
			}
		}else{
			alert("请输入内容！");
		}
}
/**
 * friends.php 
 * 友情链接
**/
function upfriendlinkrank(obj,obj2,obj3){
	if(obj3 == "friend"){
		if(numcheck(obj2)){
			window.location.href="friends.php?id="+obj+"&act=update&value="+obj2;
		}else{
			alert("请输入数字！");
	}}	
	if(obj3 == "help"){
		if(numcheck(obj2)){
			window.location.href="help.php?id="+obj+"&act=update&value="+obj2;
		}else{
			alert("请输入数字！");
	}}
	if(obj3 == "bbs"){
		if(numcheck(obj2)){
			window.location.href="bbscontlist.php?id="+obj+"&act=update&value="+obj2;
		}else{
			alert("请输入数字！");
	}}
}

/**
 * helpadd.php 
 * 友情链接
**/
function friendaddlink(){
	var name = document.getElementById("helpname").value;
	var rank = document.getElementById("helprank").value;
	if(name != "" && rank != ""){
			if(numcheck(rank)){
				document.theForm.submit();
			}else{
				alert("排序只能是数字");
		   }
	}else{
		alert("请输入内容！");
	}
}

/**
 * novel.php
 * 小说列表
 **/
function updatenoveldates(id,obj,act){
	if(numcheck(obj)){
		window.location.href="novel.php?id="+id+"&act="+act+"&value="+obj;
	}else{
		alert("请输入数字！");
	}
}
function novelcheck(){
	var val  = document.getElementById("selectvalue").value;
	var obj  = document.getElementById("stylename");
	var ind  = obj.selectedIndex;
	var styl = obj.options[ind].value;
	var stat = numcheck(val);
	if(val != "")
	{
			if(styl != 0)
		{		
			document.theForm.submit();	
		}else
			{   
				alert("请选择类型!");
			}
	}else 		
	{
		alert("请输入内容!");
	}
}

/*
**** proplist.tpl
**** 道具列表
*/
function propcheck(){
	var val  = document.getElementById("selectvalue").value;
	var obj  = document.getElementById("stylename");
	var ind  = obj.selectedIndex;
	var styl = obj.options[ind].value;
	var stat = numcheck(val);
	if(val != "")
	{
			if(styl != 0)
		{		
			if(Number(styl) == 1){
				if(stat){
					document.theForm.submit();
				}else{
					alert("请输入正确的内容!");
				}
			}
			if(Number(styl) == 2){
				document.theForm.submit();
			}
			if(Number(styl) == 3){
				if(stat)
				{
					document.theForm.submit();
				}else{
					alert("请输入正确的内容!");
				}
			}
		}else
			{   
				alert("请选择类型!");
			}
	}else 		
	{
		alert("请输入内容!");
	}
}
/**
 * proplist.php 
 * 道具添加
**/
function uprank(obj,obj2,obj3){
	if(numcheck(obj2)){
		window.location.href= obj3+".php?id="+obj+"&act=update&value="+obj2;
	}else{
		alert("请输入数字！");
	}
}

/**
 * owenconfig.php
 * 修改配置
 **/
function checkstye(i,st){
	if(i>0){
		var j=i-1;
		var ii = st+i;
		var jj = st+j;
		var q = i+1;
		var qq = st+q;
		var val1 = document.getElementById(ii).value;
		var val2 = document.getElementById(jj).value;
		var val3 = document.getElementById(qq).value;
		if(val1 != ''&&val2 =="" || val1 =="" && val3 !=''){
			document.getElementById('acti').value = "upfal";
			document.getElementById(ii).value = "";
			alert("请按顺序填入内容");
		}
	}
}
function checks(){
	var val = document.getElementById('acti').value;
	if(val=="upsure"){
		document.theForm.submit();
	}else{
		alert("输入有问题");
	}
}
/*
**** propadd.tpl
**** 道具列表
*/
function addpropcheck(){
	var name = document.getElementById("linkname").value;
	var brief= document.getElementById("briefintro").value;
	var obj  = document.getElementById("linksta");
	var ind  = obj.selectedIndex;
	var styl = obj.options[ind].value;
	if(name != "")
	{
		if(styl != 0)
		{		
			if(brief != ''){
				document.theForm.submit();
			}else{
				alert("请填写功能简介!");
			}
		}else{   
			alert("请选择功能!");
		}
	}else 		
	{
		alert("请输入道具名称!");
	}
}
